package com.yumo.kangchenjunga.importer;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public final class ImporterController {

	private final ImporterService service;

	@Autowired
	public ImporterController(ImporterService service) {
		this.service = service;
	}

	@PostMapping("/api/v1/upload")
	public String singleFileUpload(@RequestParam MultipartFile file) throws IOException {
		return service.storeFile(file).toString();
	}
}
